import request from '@/api/basic/http'

//所有商品分类
export function goods() {
  return request({
    url: '/good/class',
    method: 'get',
  })
} 
//新曾商品分类
export function goodsAdd(data) {
  return request({
    url: '/good/class/add',
    method: 'post',
    data
  })
}
//编辑商品分类
export function goodsEdit(data) {
  return request({
    url: '/good/class/edit',
    method: 'post',
    data
  })
}
//删除商品分类
export function goodsDelete(data) {
  return request({
    url: '/good/class/delete',
    method: 'post',
    data
  })
}

/**
 * 规格名称
 */
//新曾规格名称
export function specAdd(data) {
  return request({
    url: '/good/spec/add',
    method: 'post',
    data
  })
}

//规格名称查找
export function specFind(data) {
  return request({
    url: '/good/spec/find',
    method: 'post',
    data
  })
}
//规格树
export function specFindTree(data) {
  return request({
    url: '/good/spec/find_tree',
    method: 'post',
    data
  })
}

/**
 * 规格值
 */

export function specValues(data) {
    return request({
      url: '/good/spec/values',
      method: 'post',
      data
    })
  }
  //新增规格值
export function specValueAdd(data) {
    return request({
      url: '/good/spec/values/add',
      method: 'post',
      data
    })
  }

  /**
   * 新增商品
   */
  export function addGoods(data) {
    return request({
      url: '/good/add',
      method: 'post',
      data
    })
  }
  export function updateSingle(data) {
    return request({
      url: '/good/update_single',
      method: 'post',
      data
    })
  }
  //更新商品信息
  export function updateGood(type,data) {
    return request({
      url: '/good/update',
      method: 'post',
      data:{
        type,
        data
      }
    })
  }

  //获取商品列表
  export function goodPage(data) {
    return request({
      url: '/good/page',
      method: 'post',
      data
    })
  }

  /**
   * 商品规格
   */

//批量添加
  export function goodSpecAdd(data) {
    return request({
      url: '/good/spec/add',
      method: 'post',
      data
    })
  }

  //查询商品规格表
  export function specTablePage(data) {
    return request({
      url: '/good/spec/page',
      method: 'post',
      data
    })
  }
  //更新商品规格
  export function specUpdate(data) {
    return request({
      url: '/good/spec/update',
      method: 'post',
      data
    })
  }
  //删除单个商品的规格
  export function deleteSpec(data) {
    return request({
      url: '/good/spec/delete_one',
      method: 'post',
      data
    })
  }